package com.shxzz.easy12306.framework.starter.common.mq.base;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.UUID;

/**
 * 消息体包装类
 * @author shxzz
 * @create 2024-03-10-19:05
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class MessageWrapper<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 3926460511600973400L;

    /**
     * 消息发送 keys，业务唯一标识
     */
    private String keys;

    /**
     * 消息体
     */
    private T message;

    /**
     * 消息唯一标识
     */
    private final String uuid = UUID.randomUUID().toString();

    /**
     * 消息发送时间戳
     */
    private final Long timestamp = System.currentTimeMillis();
}
